/*
 * Copyright (c) gitee.com/jiandong001.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */


//TODO: enum IS Better?
export const enum YogaPositionType {
  STATIC = 0,
  RELATIVE = 1,
  ABSOLUTE = 2,
}

export function getYogaPositionTypeFromNumber(value: number): YogaPositionType | never {
  switch (value) {
    case 0: return YogaPositionType.STATIC;
    case 1: return YogaPositionType.RELATIVE;
    case 2: return YogaPositionType.ABSOLUTE;
    default: throw new Error("Unknown enum value: " + value);
  }
}

//export class YogaPositionType {
//  static readonly STATIC = 0
//  static readonly RELATIVE = 1
//  static readonly ABSOLUTE = 2
//
//  private readonly mIntValue: number;
//
//  constructor(intValue: number) {
//    this.mIntValue = intValue;
//  }
//
//  public intValue(): number {
//    return this.mIntValue;
//  }
//
//  public static fromNumber(value: number): number {
//    switch (value) {
//      case 0: return YogaPositionType.STATIC;
//      case 1: return YogaPositionType.RELATIVE;
//      case 2: return YogaPositionType.ABSOLUTE;
//      default: throw new Error("Unknown enum value: " + value);
//    }
//  }
//}
